#include<iostream>
#include<vector>
using namespace std;
int minSubArrayLen(int target, vector<int>& nums) {
    int n = nums.size(), len = INT_MAX, sum = 0;
    for (int left = 0, right = 0; right < n; right++)
    {
        sum += nums[right];
        while (sum >= target)
        {
            len = min(len, right - left + 1);
            sum -= nums[left++];
        }
    }
    return len;
}

int main()
{
    vector<int> num({ 2, 3, 1, 2, 4, 3 });
    int n = minSubArrayLen(7, num);
    cout << n << endl;
    return 0;
}